import requests
from pyquery import PyQuery

data_source = [
    'http://i.youku.com/i/UMzE2OTY2NjUy/videos?spm=a2hzp.8244740.0.0']


def main():
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36',
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'}
    for source_url in data_source:
        response = requests.get(source_url, headers=headers)
        # print(response.text)
        jq = PyQuery(response.text)
        for child in jq('.videos-list .items>div').items():
            print(child.find('img'))
            print(child.find('img').attr('alt'))
            print(child.find('img').attr('src'))
            print(child.find('a').attr('href'))
            print(child.find('.v-time').text())
            # print(help(child))
            break
        # print(len(jq('.videos-list .items>div')))

if __name__ == '__main__':
    main()

